<!DOCTYPE html>
<html lang="en">
  <head>
    <meta charset="UTF-8" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0" />
    <title>Document</title>
  </head>
  <body>
    <input
      type="checkbox"
      id="elInput"
      data-username="jack"
      data-age="20"
      data-max-age="21"
      data-max-top-age="30"
    />

    <script>
      const elInput = document.getElementById("elInput");

      console.log(elInput.getAttribute("data-username"));
      console.log(elInput.getAttribute("data-age"));

      console.log(elInput.dataset);
      console.log(elInput.dataset.username);
      console.log(elInput.dataset.age);
      console.log(elInput.dataset.maxAge);
      console.log(elInput.dataset.maxTopAge);
    </script>
  </body>
</html>
